#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
int main()
{
  printf("我是父进程，我的pid是:%d\n",getpid());
  pid_t id = fork();
  if(id == 0)
  {
    //child
    printf("我是子进程，我的pid是：%d\n",getpid());
   // char *const argv_[] = {
   //   
   // }
    char *const argv_[] = {
      (char*) "ls",
      (char*) "-l",
      (char*) "-a",
      NULL
    };
    execv("/usr/bin/ls",argv_);
    exit(1);
  }

  int status = 0;
  int ret  = waitpid(id,&status,0);
  if(ret == id)
  {
    sleep(2);
    printf("父进程等待成功\n");
  }
  return 0;
}
